package com.woniuxy01;

public class Test01 {
    public static void main(String[] args) {
        String source = "abc", target = "aeabcerbabcerereacbcrer";
        int  count= getMyCount(source, target);
        System.out.println(count);
    }

    private static int getMyCount(String source, String target) {
        int count = 0;
        int index = target.indexOf(source);
        while (index != -1) {
            count++;
            index = target.indexOf(source, index + source.length());
        }
        return count;
    }

    private static boolean findSubString(String source, String target) {
        int m = 0, n = 0;
        while (m < source.length() && n < target.length()) {
            if (source.charAt(m) == target.charAt(n)) {
                m++;
            }
            n++;
        }
        return m == source.length();
    }

    private static String reverse(String str) {
        return new StringBuilder(str).reverse().toString();
    }
}
